package exo1.iterator;

import exo1.GenericPile;

public class GenericPileIterator<T> implements MyIterator<T>  {

	private GenericPile<T> pile; 
	private int index=0;
	public GenericPileIterator(GenericPile<T> genericPile) {
		pile=genericPile;
	}

	@Override
	public boolean isDone() {
			return !(pile.lenght()==index);
	}

	@Override
	public T current() {
		assert index<pile.lenght():"Index out of bound";
		return (T) pile.get(index);
	}

	@Override
	public void next() {
		index++;
		
	}


	
	
}
